package com.smartwebx.ha.dal.feature.sqlprovider;

import static org.apache.ibatis.jdbc.SqlBuilder.*;

import java.util.Map;

import com.smartwebx.ha.dal.config.OracleConfigInfo;

public class FeatureAllWaterMapperProvider {
	String TZ_MZ_T = OracleConfigInfo.FEATURE_NAME + ".TZ_MZ_T";
	String TZ_DZMY_T = OracleConfigInfo.FEATURE_NAME + ".TZ_DZMY_T";
	String TZ_MQ_T = OracleConfigInfo.FEATURE_NAME + ".TZ_MQ_T";

	public String getPeriodAvgContrastWaterSQL(Map<String, Integer> maps) {
		Integer startMonth = maps.get("startMonth");
		Integer startDay = maps.get("startDay");
		Integer endMonth = maps.get("endMonth");
		Integer endDay = maps.get("endDay");
		maps.put("firstParam", (startMonth * 100 + startDay));
		maps.put("sencondParam", (endMonth * 100 + endDay));

		BEGIN();
		SELECT("MNTH,DAY,AVUPZ avgWater");
		FROM(TZ_DZMY_T);
		WHERE("stcd = #{stcd}");
		WHERE("(MNTH * 100 +DAY) >= #{firstParam}");
		WHERE("(MNTH * 100 + DAY) <= #{sencondParam}");
		return SQL();
	}

	public String getMoreYearStatHighLowWaterSQL() {
		BEGIN();
		SELECT("HUPZ maxz,HUPZTM maxzTm,LUPZ minz,LUPZTM minzTm,AVUPZ avgz,YR avgTm");
		FROM(TZ_MZ_T);
		WHERE("STCD=#{stcd}");
		WHERE("PRD=13");
		return SQL();
	}

	public String getMoreYearStatHighLowFlowSQL() {
		BEGIN();
		SELECT("MXQ maxz,MXTM maxzTm,MNQ minz,MNTM minzTm,AVQ avgz,YR avgTm");
		FROM(TZ_MQ_T);
		WHERE("STCD=#{stcd}");
		WHERE("PRD=13");
		return SQL();
	}

}